package com.ican.oc.dao;

import org.springframework.stereotype.Repository;

import com.ican.oc.common.hibernate.OcHibernateDao;
import com.ican.oc.domain.OcOptionDescription;

@Repository("ocOptionDescriptionDao")
public class OcOptionDescriptionDao extends OcHibernateDao<OcOptionDescription, Integer> {

    public OcOptionDescription findOptionDescByNameCodeAndLang(String name, Integer langId) {
        String hql = "from OcOptionDescription where name = ? and pk.languageId = ?";
        return findUnique(hql, new Object[]{name, langId});
    }
    
    public OcOptionDescription findOptionDescByNameAndLang(Integer id, String name, Integer langId) {
        String hql = "from OcOptionDescription where pk.optionId = ? and name = ? and pk.languageId = ?";
        return findUnique(hql, new Object[]{id, name, langId});
    }
}
